/**
 * @param {number[]} nums
 * @return {boolean}
 */
var canJump = function (nums) {
    let len = nums.length,
        target = len - 1;

    for (let i = len - 2; i >= 0; i--) {
        while (i >= 0 && i + nums[i] < target) {
            i--
        }
        if (i === -1) {
            return false
        }
        target = i
    }
    return true
};